home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / SC7 patch - trans only / SC7 Translator README < prev   
Text File  |  1994-03-23  |  8KB  |  170 lines

  1. Symantec C++ 7.0 Compiler Release Notes
  2. =====================================
  3. Copyright © 1994 Symantec Corporation. All rights reserved.
  4. March 23, 1994
  5. Font: Geneva 12
  6.  
  7. The compiler team has placed heavy emphasis on code generation for this release.  You will find that the code generation has improved significantly over the 6.0.1 compiler.  We have improved our internal testing strategy for the compiler which has greatly improved the overall quality.  We have succeeded in removing all of the known code generation problems.  If you encounter a suspected code generation problem with the compiler, do not assume that we know about it already.  Please send any and all problems via Applelink to THINK.BUGS, or call our technical support hotline.
  8.  
  9. Compiler Release Highlights
  10. ==================
  11.  
  12. 1.  All of the reported multiple inheritance code generation problems have been fixed.
  13.  
  14. 2. The code generation has been significantly improved, and all known code generation bugs have been fixed.
  15.  
  16. 3. Pascal object support has been improved, and numerous problems with pascal object support have been addressed.  Specifically:
  17.  
  18.   • Pascal object now calls constructors and destructors correctly up the inheritance chain.
  19.  
  20.   • Pascal object classes can now contain non pascal object structures inside them, the code generation problems with this have been fixed.
  21.  
  22.  
  23. 4. Numerous front-end problems have been fixed, and the process of moving towards the emerging ANSI C++ draft standard has begun.  
  24.  
  25. 5. The compiler now merges constant strings together within a translation unit.  For example, each use of __FILE__ will share the same string storage.  This will reduce the amount of data overhead required when using the assert() macro.
  26.  
  27.  
  28. 6. The maximum size of a mangled name has been increased from 256 characters to 1024 characters.  This should allieviate problems using the  Booch components and other programs with deeply nested template constructs.
  29.  
  30. Important Release Notes
  31. ======================
  32.  
  33. 1. If your project type is a code resource virtual functions cannot be used.  The data-to-code relocations which are used for other project types are not safe because the code segment can be moved between invocations of the code resource.  This is a restriction on code resources and is not considered a bug.
  34.  
  35. 2. If your project type is a code resource, static constructors are not called.  This is because it is impossible for the run-time library to determine when the program is starting to execute.  Work around this by constructing objects explicitly.
  36.  
  37. 3. Template classes that contain virtual functions must be expanded using the #pragma template directives outlined in the documentation.  This is because the compiler will generate the virtual tables globally even though the other class information is static.  For example:
  38.  
  39. x.h:
  40.  #pragma template_access extern        // Required because class X has virtual functions
  41. 
  42.  template <class T> class X {
  43.    T t;
  44.    virtual void f(void);
  45.   };
  46.  
  47. x.c:    
  48.  #include "x.h"
  49.  #pragma template_access public        // Do this in only 1 translation unit
  50.  template <class T> void X<T>::f(void)
  51.  {
  52.   t++;
  53.  }
  54.  #pragma template X<int>                                 // instantiate global X<int>
  55.  #pragma template X<short>                         // instantiate global X<short>
  56.  
  57. If you do not do this explicit expansion, you will get multiply-defined virtual function tables in every translation unit that contains the same expansion of template class X.
  58.  
  59. 4. Unreferenced static objects.  When using the compiler, if a reference is not made to some function from a given translation unit, that unit is not included in the built object.  This means that static constructors from that translation unit are not called.  To work around this problem, insure that all files that contain static constructors have at least one function which is actually called. This behavior is correct as per the ARM.
  60.  
  61. 5. When overriding operator new and/or operator delete, use the 'CplusLib TCL' library in order to avoid multiply-defined errors for operator new and operator delete at link time.
  62.  
  63. 6. In general, the option settings used when precompiling a header should be the same settings used during the compilation.  Specifically, when using the 68881 code generation option, several system includes depend on this setting and actually compile differently.  If you are compiling for 68881 code generation, make sure you re-precompile any precompiled headers prior to building your application.  This problem is most noticeable for setjmp.h, which saves and restores the FPU registers if 68881 code generation is turned on.  
  64.  
  65. New Error and Warning Messages
  66. =============================
  67.  
  68. The following error messages were added too late to make it into the documentation:
  69.  
  70. 1. type or storage class is required in the declaration of '<identifier>'
  71.  
  72. This error message is received when a type name has not been declared properly and an attempt is made to declare a variable of that type.  For example:
  73.  
  74.     ABC abc;            // If ABC is not declared as a type, you receive the above error message
  75.  
  76. This error is also received when an attempt is made to declare an identifier without a type
  77. or storage class.  For example:
  78.  
  79. j;                            // Attempt to declare j as an int will receive error message.
  80.  
  81. 2. Function definitions with seperate parameter lists are obsolete in C++
  82.  
  83. This error message is a warning when not using ANSI mode, but becomes an error when ANSI mode is turned on.  It indicates that you are using an old-style C declaration for a function.  For example:
  84.  
  85.     void f(int, int, char *);
  86.  
  87.     void f( a, b, c )            // Error
  88.     int a;
  89.     int b;
  90.     char *c;
  91.     {
  92.     }
  93.  
  94. 3. Casting from incomplete structure type <identifier>
  95.  
  96. This warning message indicates that an attempt was made to cast from an incomplete structure type.  This can cause problems if this class is later declared in a multiple inheritance relationship with the destination type.  Such a cast could require modification of the pointer's value.  When working with forward-declared classes, the compiler must assume that no modification is required.  For example:
  97.  
  98. file1.c:
  99.     struct A *p;
  100.     struct B *p2;
  101.  
  102.     p = (A *) p2;             // Warning
  103.  
  104. file2.c:
  105.     struct  A { };
  106.     struct B : public virtual A { };
  107.  
  108. This program might crash at run-time because the cast in file1.c will not change the pointer correctly.  This cast could be avoided altogether because if the types are complete, you can implicitly convert from a B * into an A *.
  109.  
  110. 4. Illegal use of template type arugment during expansion of template <identifier>
  111.  
  112. This error is received when attempting to use a template argument after the class name in the declaration of the class, or after the constructor or destructor declaration.   For example:
  113.  
  114.     template <class T> class X<T>        { };        // Error, do not use <T> after the class name X
  115.  
  116. 5. Maximum number of 10 nested template expansions exceeded for expansion of '<identifier>'
  117.  
  118. This error is received when attempting to nest template expansions beyond 10 levels.  It normally occurs when an infinite template expansion is detected.
  119.  
  120. Manual Errata
  121. ============
  122.  
  123. The 'Warning Messages' page of the C++ compiler options dialog on p. 106 of the compiler guide was updated after the documentation was complete.  The screen shot below is the current composition of this dialog box:
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147. The two options not covered in the documentation are:
  148.  
  149. 1. 'Old style function definitions' - This option controls whether old C style function definitions produce a warning.  If the ANSI switch is on, this warning becomes an error and cannot be disabled.  For example:
  150.  
  151.     void f(a)            // Warning: Function definitions with seperate parameter lists are 
  152.                                          // obsolete in C++
  153.     int a;
  154.     {
  155.     }
  156.  
  157. 2. 'Cast from incomplete type' - This option controls whether a warning message is produced when a cast is made from a pointer to an incomplete structure type to a pointer to another structure type.  This can cause problems if this class is later declared in a multiple inheritance relationship because the cast could change the value of the pointer.  Whenever a cast is made from a structure type to another structure type, both types should be complete in order to guarantee correct code generation.  For example:
  158.  
  159. file1.c:
  160.     struct A *p;
  161.     struct B *p2;
  162.  
  163.     p = (A *) p2;             // Warning
  164.  
  165. file2.c:
  166.     struct  A { };
  167.     struct B : public virtual A { };
  168.  
  169.  
  170.